package com.laoxu.breadcrumb.service.impl;

import com.laoxu.breadcrumb.dao.CategoryRepository;
import com.laoxu.breadcrumb.entity.Category;
import com.laoxu.breadcrumb.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @Description:
 * @Author laoxu
 * @Date 2019/10/5 15:11
 **/
@Service
@Transactional
public class CategoryServiceImpl implements CategoryService {

    @Autowired
    private CategoryRepository categoryRepository;

    @Override
    public List<Category> findByParentId(Long parentId) {
        return categoryRepository.findByParentId(parentId);
    }

    @Override
    public List<Category> findAllById(Long id) {
        return categoryRepository.findAllById(id);
    }

    @Override
    public List<Category> findByLevel(Integer level) {
        return categoryRepository.findByLevel(level);
    }
}
